<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Details du factures</title>


<!---------------------for autocomplete--------------->
	<script type="text/javascript" src="<?php echo base_url('assets/js/jquery-1.11.0.min.js');?>" ></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/jquery-ui-1.10.4/js/jquery-ui-1.10.4.min.js');?>" ></script>
	<link href="<?php echo base_url("assets/css/jquery-ui.css")?>" rel="stylesheet" type="text/css" />
<!---------------------for form css ----------------------->
	<link href="<?php echo base_url("assets/css/pure.css")?>" rel="stylesheet" type="text/css" />
<!---------------------for form validation ----------------------->
<script type="text/javascript" src="<?php echo base_url('assets/js/jquery.validate.js');?>" ></script>
<!---------------------for form mask input ----------------------->
<script type="text/javascript" src="<?php echo base_url('assets/js/jquery.mask.min.js');?>" ></script>

 <link href="<?php echo base_url("assets/css/botton.css")?>" rel="stylesheet" type="text/css" />
 
</head>
<body>
<?php
include_once('header.php');

// ----- populate $liste_des_fournisseurs array for autocomplete ----- //
$liste_des_fournisseurs = array();
foreach ($liste_fourn as $lf){
	array_push($liste_des_fournisseurs, $lf->nom);
}
// ----- populate $liste_des_activites array for autocomplete ----- //

?>
<?php
echo form_open_multipart( base_url('mondat_ctr/valider_ajout') ); 
?>

<form id="fournisseur_frm" class="pure-form pure-form-stacked" method="POST" action="<?php echo base_url('facture_ctr/valider_ajout');?>">
    <fieldset>
        <legend>اضافة حوالة الدفع</legend>

        <div class="pure-g">
            <div class="pure-u-1 pure-u-md-1-3">
                <label for="fournisseur">المورد </label>
				<input id="nom" name="fournisseur" type="text" ">
            </div>

            <div class="pure-u-1 pure-u-md-1-3 ">
                <label for="article">وصل الطلب </label>
                <input  class="ltr" id="bc" name="bc" type="text" >
            </div>

            <div class="pure-u-1 pure-u-md-1-3 ">
                <label for="numero"> رقم الصك</label>
				<input class="ltr" id="numero" name="cheque" type="text" >
                
            </div>

           
			
		
			
			<div class="pure-u-1 pure-u-md-1-3">
                <label for="address">رقم الفاتورة </label>
                <input id="montant" name="facture" type="text" >
            </div>
			
			<div class="pure-u-1 pure-u-md-1-3">
                <label for="address">المبلغ </label>
                <input id="montant" name="montant" type="text" >
            </div>
			
			
			
        </div>

      <input type="submit" value="اضافة"  class="pure-button pure-button-primary" />
      <a href="<?php echo base_url("/mondat_ctr/")?>" class="pure-button pure-button-primary">عودة</a>
    
    </fieldset>
</form>

</body>
<script>
$(function() {
	

var liste_fourniss = <?php echo json_encode($liste_des_fournisseurs); ?>;


$( "#nom" ).autocomplete({source: liste_fourniss});



});

//---

$('#submit_btn').click(function() {
  if($("[class^=error]").is(":visible")){
    alert('منالك حقل / حقول إدخال غير مطابقة !');
    return false;
  } else {
  	$('#fournisseur_frm').submit();
    return false;
  }
});


$('#numero').bind('mouseup keyup focusout focus mousemove',function() {
    $('span.error-rc').hide();
	$(this).css('background-color','pink');
    var inputVal = $(this).val();
    //var characterReg = /^([a-zA-Z0-9]{7,16})$/;
    var characterReg = /^([0-9]{1,3})$/;
    if(!characterReg.test(inputVal)) {
        $(this).after('<span class="error-rc" flag="required" style="color:red;" >حقل غير مطابق للشكل العام </span>');
    }else{
		$(this).css('background-color','#FFFFFF');
	}
});
$('#mondat').bind('mouseup keyup focusout focus mousemove',function() {
    $('span.error-rc').hide();
	$(this).css('background-color','pink');
    var inputVal = $(this).val();
    //var characterReg = /^([a-zA-Z0-9]{7,16})$/;
    var characterReg = /^([0-9]{1,3})$/;
    if(!characterReg.test(inputVal)) {
        $(this).after('<span class="error-rc" flag="required" style="color:red;" >حقل غير مطابق للشكل العام </span>');
    }else{
		$(this).css('background-color','#FFFFFF');
	}
});




//---* maskage below 
$('#numero').mask('AAA', {'translation': {
                                        A: {pattern: /[0-9]/},
										O: {pattern: /[0-9]/, optional: true},
										D: {pattern: /[a-zA-Z]/}
                                      }
                                });

//---* maskage below 
$('#mondat').mask('AAA', {'translation': {
                                        A: {pattern: /[0-9]/},
										O: {pattern: /[0-9]/, optional: true},
										D: {pattern: /[a-zA-Z]/}
                                      }
                                });





</script>
</html>